<?php
namespace app\index\controller;

use app\BaseController;

class WxappApi extends BaseController
{

    /**
     * 获取code2Session
     * @return void
     */
    public function jscode2session($code)
    {
        $url = "https://api.weixin.qq.com/sns/jscode2session?appid=".WXAPPID."&secret=".WXAPPSECRET."&js_code=$code&grant_type=authorization_code";
        $res = curlRequest($url, false, 0);
        return json_decode($res,true);
    }



}
